package trading.algo;

import java.util.TimerTask;

import trading.bo.EmailAccessorBO;
import trading.bo.IBAccessorBO;

public class OptionMktOrderTask extends TimerTask{

	private IBAccessorBO ibAccessorBO;
	private EmailAccessorBO emailAccessorBO;
	private String action;
	private int size;
	private String orderType;
	private String ticker;
	private String expiry;
	private double strike;
	private String right;
	
	public OptionMktOrderTask(IBAccessorBO ibAccessorBO, EmailAccessorBO emailAccessorBO, String action, int size, String orderType, String ticker, String expiry, double strike, String right) {
		this.ibAccessorBO = ibAccessorBO;
		this.emailAccessorBO = emailAccessorBO;
		this.action = action;
		this.size = size;
		this.orderType = orderType;
		this.ticker = ticker;
		this.expiry = expiry;
		this.strike = strike;
		this.right = right;
	}
	
	@Override
	public void run() {
		this.ibAccessorBO.createOptionOrder(action, size, orderType, ticker, expiry, strike, right);
		
        this.emailAccessorBO.sendNewOptionOrderEmail(action, ticker,
                orderType, size + "", expiry, strike + "", right);
	}
	
	public static int secondsNeeded() {
	    return 2;
	}

}
